package com.sc.service.member;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sc.dal.dto.member.MemberNewsDto;
import com.sc.dal.dto.member.NewsTypeDto;
import com.sc.dal.mapper.member.MemberNewsMapper;
import com.sc.dal.model.member.MemberCard;
import com.sc.dal.model.member.MemberNews;
import com.sc.service.BaseServiceImpl;

/**
 * @ClassName: MemberCardService
 * @Description: 用户银行卡管理service
 * @author LeiJia
 * @date 2017年3月20日 下午14:52:26
 * @version V1.0
 */
@Service
public class MemberNewsService extends  BaseServiceImpl<MemberCard>{
	
	@Autowired
	private MemberNewsMapper memberNewsMapper;	
	
	//添加消息通知
	public int insertMemberNews(MemberNews news){
		return memberNewsMapper.insertSelective(news);
	}
	
	//根据消息主键获取一条消息
	public MemberNews memberNewsList(Integer id){
		return memberNewsMapper.selectByPrimaryKey(id);
	}
	
	//根据会员id获取用户消息类别列表和各个类别的最新消息列表
	public List<NewsTypeDto> selectMemberNewsTypeListByMid(String mId){
		return memberNewsMapper.selectMemberNewsTypeListByMid(mId);
	}
	
	//根据消息类别和用户Id获取对应类别的消息信息列表
	public List<MemberNewsDto> selectMemberNews(String type,String mId){
		MemberNewsDto dto = new MemberNewsDto(type,mId);
		return memberNewsMapper.selectMemberNewsDtoList( dto);
	}
}
